package spec.chengyunwei;

import java.util.Collection;

public class Example5_1 {
    public  static  void main( String[] args){
        student stu1=new student();
        stu1.setStuNo("0908233111");
        stu1.setStuName("陈君祥");
        stu1.setStuAge("21");
        stu1.setStuAddress("江苏徐州");
        student stu2=new student();
        stu2.setStuNo("0908233112");
        stu2.setStuName("章家其");
        stu2.setStuAge("22");
        stu2.setStuAddress("江苏南京");
        Collection collection=new ArryList();
        collection.add(stu1);
        collection.add(stu2);
        System.out.println("after add object");
        System.out.println("collection.size()="+collection.size());
        collection.remove(stu1);
        System.out.println("after remove stu1:");
        System.out.println("collection.size()="+collection.size());
        boolean isEmpty=collection.isEmpty();
        System.out.println("集合是否为空："+isEmpty);
        boolean isContains=collection.contains(stu2);
        System.out.println("集合是否包含stu2:"+isContains);

        //清除集合内的对象
        collection.clear();
        System.out.println("afeter clear:");
        System.out.println("collection.size()="+collection.size());
    }

}
